"""
【练习】词频统计
编写一个Python程序，来计算给定文本中每个单词出现的次数
"""


def count_num(data):
    num = data.split()
    empty_dict = {}
    for nums in num:
        nums = nums.strip(',.')
        if nums in empty_dict:
            empty_dict[nums] += 1
        else:
            empty_dict[nums] = 1
    for k, v in empty_dict.items():
        print(k,v)


count_num("hello world, hello Python. my name is Jack")





